<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="选择员工" />
<%@ include file="../inc/Title.jsp"%>
<head>
<link rel="stylesheet" type="text/css" href="/css/base.css" />
<link href="/css/Query.css" rel="stylesheet" type="text/css">
<script src="/js/QueryList.js"></script>
<script language="javascript">
	function selectStaffer(index){
		var ob_arr = document.getElementsByName("query_checkbox");
		var str="";
		if ( ob_arr.length>=index ){
			str=ob_arr[index-1].value+";"+ob_arr[index-1].getAttribute("staffer_name")+";"+ob_arr[index-1].getAttribute("dep_id");
		}
		if (str != null && str!=''){
			parent.parent.popRetVal=str;
			parent.parent.ClosePop();
		}
	}
	function DoubleClick(it){
		var ob_arr = document.getElementsByName("query_checkbox");
		var str="";
		if(ob_arr.length>=it.getAttribute("index")){
			str=ob_arr[it.getAttribute("index")-1].value+";"+ob_arr[it.getAttribute("index")-1].getAttribute("staffer_name")+";"+ob_arr[it.getAttribute("index")-1].getAttribute("dep_id");
		}
		if(str==""){
			return;
		}
		parent.parent.popRetVal=str;
		parent.parent.ClosePop();
	}
	function doSearch(){
		var departmentId="${departmentId}";
		var searchKey=encodeURIComponent(document.getElementById("search_key").value.trim());
		var searchAll="";
		if(document.getElementById("search_all").checked){
			searchAll="1";
		}
		window.location="/base/StafferListForSelect.ihtm?department_id="+departmentId+"&search_key="+searchKey+"&search_all="+searchAll;
	}
	function doInit(){
		Window_Onload();
		document.getElementById("search_key").focus();
	}
	function checkSearchKey(){
		if(window.event.keyCode==13){
			doSearch();
		}
	}
</script>
</head>
<body oncontextmenu="return false" onload="doInit();" scroll="no" style="background: #EAFAFF;">
		<div id="scrollDiv" style="OVERFLOW-Y:auto;height:348px">
		  <div class="main search-business">
			   <div class="cue-info">
					<h4>
						<c:if test="${searchAll=='1'}">所有部门 - 员工</c:if>
						<c:if test="${searchAll!='1'}">${department.departmentName} -  员工</c:if>
					</h4>				   	
			  </div>
			  <div class="content">		
				  <div align="right">
					<input type="text" class="TextBox" id="search_key" name="search_key" onKeyUp="checkSearchKey();"  value="${searchKey}" title="以员工姓名、姓名拼音字头进行模糊查询">
					<input type="checkbox" id="search_all" name="search_all" <c:if test="${searchAll=='1'}">checked</c:if>>在所有部门中查找
					<input type="button" class="buttom search-but" value=" 查 询" onClick="doSearch();" title="以员工姓名、姓名拼音字头进行模糊查询">			  		             	
		          </div>
			  </div>			  
			  <%@include file="../inc/AlertMsg.jsp"%>
			  <div class="table-list" style="width:97%; padding:15px 0 15px 10px; float:left;">
						<table width="100%">
								<tr>
									<th width="14"></th>
									<th width="30%">部门</th>
									<th width="20%">姓名</th>
									<th width="30%">职位</th>
									<th width="20%">操作</th>
								</tr>
								<c:forEach var="item" items="${stafferList}" varStatus="i">
								<c:if test="${(i.index mod 2)==0}"><c:set var="trClass" value="query_list_data_tr1" /></c:if>
								<c:if test="${(i.index mod 2)!=0}"><c:set var="trClass" value="query_list_data_tr2" /></c:if>
								<tr class="${trClass}" index="${i.index+1}" style='cursor:pointer;' onmouseout='javascript:mouseout(this)' ondblclick='javascript:DoubleClick(this)' onmouseover='javascript:mouseover(this)' onClick='javascript:ClickCheck(this)'>
									<td><input type="radio" name='query_checkbox' value="${item.staffer.id}" staffer_name="${item.staffer.stafferName}" dep_id="${item.staffer.departmentId}"></td>
									<td>${item.depName}</td>
									<td>${item.staffer.stafferName}</td>
									<td>${item.staffer.possie}</td>
									<td class="ListTd">
										<a href="javascript:selectStaffer('${i.index+1}');">选择</a>
									</td>
								</tr>
								</c:forEach>		
						</table>
			  </div>
			</div>
		</div>
</body>
</html>